<template>
  <div class="v-dialog">
    <transition name="box-card" v-if="boxshow" :close-on-click-overlay="false" :overlay="false">
      <div class="start-box-shadow">
        <div class="start-box">
          <p>{{ message }}
          </p>
          <button class="btn-2 restar" @click="enter">{{ enterTxt }}</button>
          <button class="btn-2" @click="esc">{{ escTxt }}</button>
        </div>
      </div>
    </transition>
    <div class="mask" v-show="boxshow"></div>
  </div>
</template>

<script>
export default {
  props: {
    message: {
      type: String
    },
    enterTxt: {
      type: String,
      default: "确定"
    },
    escTxt: {
      type: String,
      default: "取消"
    }
  },
  data() {
    return {
      boxshow: false
    };
  },
  methods: {
    // 确定
    enter() {
      this.$emit("enter");
      this.boxshow = false;
    },
    // 取消
    esc() {
      this.$emit("esc");
      this.boxshow = false;
    }
  }
};
</script>

<style lang="less" scoped>
.box-card-enter-active,
.box-card-leave-active {
    transition: all .5s;
}

.box-card-enter,
.box-card-leave-to {
    opacity: 0;
    transform: translateY(-20px);
}
.mask {
  position: absolute;
  height: 100%;
  width: 100%;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 200;
}
.start-box-shadow {
    position: absolute;
    width: 100%;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    top: 0;
    border-radius: 40px;
    z-index:201;
}
.start-box {
  width: 420px;
  padding: 20px 0;
  background: #fff;
  text-align: center;
  position: absolute;
  top:50%;
  left:50%;
  transform: translate(-50%,-50%);
  border-radius: 5px;
  p {
    line-height: 60px;
    padding: 0 20px;
    font-size: 14px;
    color: #333333;
  }
  .btn {
    margin-top: 40px;
    width: 60px;
    height: 32px;
    background-color: #4285F4;
    text-align: center;
    line-height: 32px;
    font-size: 14px;
    color: #ffffff;
    border-radius: 5px;
    outline: none;
    border:none;
    cursor: pointer;
  }
  span {
    font-size: 20px;
    color: #333333;
  }
  .btn-2 {
    margin-top: 20px;
    width: 80px;
    height: 32px;
    background-color: #4285F4;
    text-align: center;
    line-height: 32px;
    font-size: 14px;
    color: #ffffff;
    border-radius: 5px;
    box-shadow: none;
    outline: none;
    border:none;
    cursor: pointer;
    & + .btn-2 {
      margin-left: 50px;
    }
  }
  .restar {
    background-color: #ffffff;
    color: #333333;
    border:1px solid #999999;
  }
}
.v-dialog /deep/ .van-popup {
  border-radius: 20px;
  overflow: visible;
}
</style>
